<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link href="css/register.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/swiper.min.css" />
		<link rel="stylesheet" href="css/video-js.min.css" />
		<link rel="stylesheet" href="css/newbase.css" />
		<link rel="stylesheet" href="css/newstyle.css" />
		<link rel="stylesheet" href="css/neworder.css" />
		<link rel="stylesheet" href="css/iconfont.css" />
		<link href="css/userManager.css" rel="stylesheet" />
		<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
		<style type="text/css">
			.tipDialog{
				position: fixed;
				width: 800px;
				height: auto;
				min-height: 570px;
				background: wheat;
				z-index: 10000;
				margin-top: 40px;
				margin-left: 30%;
			}
			.commentDialog{
				position: fixed;
				width: 700px;
				height: auto;
				min-height: 270px;
				background: wheat;
				z-index: 10000;
				margin-top: 40px;
				margin-left: 30%;
			}
			.tipDialog span{
				margin-top: 10px;
				margin-left: 10px;
			}
			.tipDialog div{
				margin-top: 20px;
			}
			.tipDialog button{
				width: 120px;
				height: 35px;
				border-radius: 5px;
				line-height: 35px;
				text-align: center;
			}
			.commentDialog button{
				width: 120px;
				height: 35px;
				border-radius: 5px;
				line-height: 35px;
				text-align: center;
			}
		   .button{
				display: inline-block;
				width: 68px;
				text-align: center;
				height: 20px;
				line-height: 18px;
				font-size: 12px;
				margin: 10px;
				color: #1a1a1a;
				background-color: #fff;
				border: 1px solid #1a1a1a;
				-o-border-radius: 4px;
				-webkit-border-radius: 4px;
				-moz-border-radius: 4px;
				-ms-border-radius: 4px;
				border-radius: 4px;
				cursor: pointer;
			}
		</style>
	<script type="text/javascript">
        $(document).ready(function() {

            //关闭悬浮窗口
            $("#user_close").bind("click", function() {
                if($(this).attr("id")=="user_close"){
                    $("#user_dialog").fadeToggle();
                    $("#user_background").toggle();
                }else if($(this).attr("id") == "user_delete_close"){
                    $("#user_delete_back").toggle();
                    $("#user_delete_ucard").fadeToggle();
                }

            });
            //修改/添加用户确认事件
            $("#user_confir").click(function() {
                var id = $("#dialog_id").val();
                var name = $("#dialog_name").val();
                var email = $("#dialog_email").val();
                var phone = $("#dialog_phone").val();
                var sex = $("#dialog_sex").val();
            });

            //选项卡点击事件
            $("#menu").children("li").children("a").click(function() {
                $("#menu").children("li").children("a").removeClass("on");
                $(this).addClass("on");
                var index = $(this).attr("tabindex");
                if(index == 1){
                    $("#order-send").css("display","block");
                    $("#order-recived").css("display","none");
                    $("#order-comment").css("display", "none");
				}
				if (index == 2){
                    $("#order-recived").css("display","block");
                    $("#order-send").css("display","none");
                    $("#order-comment").css("display", "none");
				}
                if (index == 3) {
                    $("#order-comment").css("display", "block");
                    $("#order-recived").css("display","none");
                    $("#order-send").css("display","none");
                }
            });

            //订单类型选项点击事件
            $("#order_type").children("span").click(function(){
                $("#order_type").children("span").removeClass("on");
                $(this).addClass("on");
            });

            //用户类型选项点击事件
            $("#user_type").children("div").click(function(){
                $(".shopTabs").children("div").removeClass("on");
                $(this).addClass("on");
            });

            //添加用户按钮
            $("#add_userd").click(function(){
                $("#user_dialog").fadeToggle();
                $("#user_background").toggle();
                $("#user_title").text("添加用户");
            });

        });
	</script>
	</head>
	<body>
		<div class="navigation animated">
			<script type="text/javascript" src="https://api.map.baidu.com/api?ak=dZjnRr2t8nBpGswyCB731AFD&v=2.0&s=1"></script>
			<div id="allmap" style="display:none;"></div>
			<div class="nav-wrap">
				<h1 class="logo">
            		<a href="javascript:;"><img src="images/UU-logo.png" alt="uu-logo" height="75px"></a>
        		</h1>
				<div class="nav">
					<ul class="nav-list clearfix">
						<li>
							<a href="index.html" title="首页">首页</a>
						</li>
						<li>
							<a href="order_taking.html" title="订单大厅">订单大厅</a>
						</li>
						<li>
							<a href="buy.html" title="在线下单">在线下单</a>
						</li>
						<li  class="active">
							<a href="myOrder.html" title="我的订单">我的订单</a>
						</li>
					</ul>
					<div style="clear:both;"></div>
				</div>
				<div class="button-group">

					<ul class="button-list welcome" id="userinfo">
						<li>
							<a href="javascript:;" class="port fl" style="height: 100%;vertical-align: middle;"><img src="images/port.png" width="22" height="22" style="margin-right: 10px;" />登录</a>
						</li>
						<li style="display: none;">
							<p class="username fl">欢迎您，<span id="userMobile"></span>
							</p>
							<a class="loginout" href="javascript:order.loginOut()">退出</a>
						</li>
					</ul>
				</div>
			</div>

		<!---->
		<div class="index">
		<div class="contentBox">
			<div class="container clear">
				<!--选项卡-->
				<div class="nav box-shadow fl" style="margin-top: 30px;">
					<ul id="menu">
						<li>
							<a tabindex="1" title="我的发单" class="on"><i class="iconfont"></i>我的发单</a>
						</li>
						<li>
							<a tabindex="2" title="我的接单" class=""><i class="iconfont"></i>我的接单</a>
						</li>
						<li>
							<a tabindex="3" title="我的评论" class=""><i class="iconfont"></i>我的评论</a>
						</li>
					</ul>
				</div>

				<!---->
				<div id="order-send" class="fl" style="width: 1010px; margin-left: 20px; height: auto; margin-top: 30px; display: block;">
					<div id="one " class="orderHistory Router">
						<div class="box-shadow uu-title ">
							<h2 style="background: white;">我的发单记录</h2>
						</div>

						<div id="order_type" class="orderType clear box-shadow ">
							<span class="fl on " name="-1">全部</span>
							<span class="fl " name="0">待接单</span>
							<span class="fl " name="1">已接单</span>
							<span class="fl " name="2">待评价</span>
							<span class="fl " name="3">已完成</span>
							<span class="fl " name="4">已取消</span>
						</div>

						<div id="order-list" class="loading " style="position: relative; ">
							<ul class="orderList">
								<li class="box-shadow popUp">
									<div class="clear orderHeader">
										<div class="fl clear left ">
											<span name="oId" class="orderId fl ">U0471600180422013329484076</span>
											<span name="title" class="orderMark fl omit">速度</span></div>
										<div class="right fr">状态
											<span name="oState">立即支付</span></div>
									</div>
									<table cellspacing="0" cellpadding="0" width="100%" class="clear orderInfo">
										<tr>
											<td class="clear firstInfo">
												<div class="orderInfo-item first  width">
													<div class="receiveInfo sendInfo">[取货]<span name="sendPhone" class="mobile">13558550380 </span>
														<span name="sendPepole">装饰</span>
														<span name="sendAddress" class="address"><span>地址：</span>成都市温江</span></div>
													<div class="sendInfo clear">[收货]<span name="receivedPhone" class="mobile">13538422201</span>
														<span name="receivedPepole">装饰</span>
														<span name="receivedAddress" class="address "><span>地址：</span>柳台大道东段208号05</span></div>
													<div class="sendInfo clear">[接单员性别]：<span name="corridorGender">男</span></div>
												</div>
											</td>
											<td class="disMon orderInfo-item firstInfo">
												<div><b>备注:</b><span name="remark">快单</span></div>
											</td>
											<td class="disMon orderInfo-item firstInfo">
												<div>金额：<span name="price">17.00</span>元</div>
											</td>
											<td class="cancelOrder">
												<span>刷新订单</span>&nbsp;&nbsp;<span>确认收货</span>
												<span>取消订单</span>&nbsp;&nbsp;<span>修改订单</span>
											</td>
										</tr>
									</table>
									<p  class="time">发单时间：<span name="oDate">2018-04-22 01:33</span></p>
								</li>
							</ul>
							<div class="el-loading-mask" style="display: block;">
								<div class="el-loading-spinner">
									<svg viewBox="25 25 50 50" class="circular">
										<circle cx="50" cy="50" r="20" fill="none" class="path"></circle>
									</svg>
								</div>
							</div>
						</div>
					</div>
				</div>

				<!---->
				<div id="order-recived" class="fl" style="width: 1010px; margin-left: 20px; height: auto; margin-top: 30px; display: none;">
					<div id="one2" class="orderHistory Router">
						<div class="box-shadow uu-title ">
							<h2 style="background: white;">我的接单记录</h2>
						</div>

						<div id="order_type2" class="orderType clear box-shadow ">
							<span class="fl on " name="-1">全部</span>
							<span class="fl " name="1">已接单</span>
							<span class="fl " name="2">待评价</span>
							<span class="fl " name="3">已完成</span>
							<span class="fl " name="4">已放弃</span>
						</div>

						<div id="order-list2" class="loading " style="position: relative; ">
							<ul class="orderList">
								<li class="box-shadow popUp">
									<div class="clear orderHeader">
										<div class="fl clear left ">
											<span name="oId" class="orderId fl ">U0471600180422013329484076</span>
											<span name="title" class="orderMark fl omit">速度</span></div>
										<div class="right fr">状态
											<span name="oState">立即支付</span></div>
									</div>
									<table cellspacing="0" cellpadding="0" width="100%" class="clear orderInfo">
										<tr>
											<td class="clear firstInfo">
												<div class="orderInfo-item first  width">
													<div class="receiveInfo sendInfo">[取货]<span name="sendPhone" class="mobile">13558550380 </span>
														<span name="sendPepole">装饰</span>
														<span name="sendAddress" class="address"><span>地址：</span>成都市温江</span></div>
													<div class="sendInfo clear">[收货]<span name="receivedPhone" class="mobile">13538422201</span>
														<span name="receivedPepole">装饰</span>
														<span name="receivedAddress" class="address "><span>地址：</span>柳台大道东段208号05</span></div>
												</div>
											</td>
											<td class="disMon orderInfo-item firstInfo">
												<div><b>备注:</b><span name="remark">快单</span></div>
											</td>
											<td class="disMon orderInfo-item firstInfo">
												<div>金额：<span name="price">17.00</span>元</div>
											</td>
											<td class="cancelOrder">
												<span>刷新订单</span>
											</td>
										</tr>
									</table>
									<p  class="time">发单时间：<span name="oDate">2018-04-22 01:33</span></p>
								</li>
							</ul>
							<div class="el-loading-mask" style="display: block;">
								<div class="el-loading-spinner">
									<svg viewBox="25 25 50 50" class="circular">
										<circle cx="50" cy="50" r="20" fill="none" class="path"></circle>
									</svg>
								</div>
							</div>
						</div>
					</div>
				</div>

				<!---->
				<div id="order-comment" class="fl" style="width: 1010px; margin-left: 20px; height: auto; margin-top: 30px; display: none;">
					<div id="one3" class="orderHistory Router">
						<div class="box-shadow uu-title ">
							<h2 style="background: white;">我的评论</h2>
						</div>
						<div id="order_type3" class="orderType clear box-shadow ">
							<span class="fl on " name="0">我发表的评论</span>
							<span class="fl " name="1">我收到的评论</span>
						</div>
						<div id="order-list3" class="loading " style="position: relative; ">
							<ul class="orderList">
								<li class="box-shadow popUp">
									<div class="clear orderHeader" style="height: 150px;">
										<div class="fl clear left ">
											<span name="oId" class="orderId fl ">订单号：<span>U0471600180422013329484076</span></span>
											<span name="title" class="orderMark fl omit">速度</span>
										<br/>
										<table style="width: 100%;text-align: left;">
											<tr><td width="90%" style="margin-left: 10px;">是否搜石灰粉 是否会开始爱发科是客服号 收到付款计划</td>
												<td><button class="button">删除评论</button></td></tr>
										</table>
										</div>
									</div>
									<p  class="time">评论时间：<span name="oDate">2018-04-22 01:33</span></p>
								</li>
							</ul>
						</div>
					</div>
				</div>

			</div>
		</div>
	</div>
</div>
		<div id="tipDialog" class="tipDialog" style="display: none;">
			<h3 style="font-size: 24px;color: white;margin:10px;margin-left: 30px;">修改订单</h3>
			<span id="oId" style="display: none"></span>
			<table>
				<div>
					<span width="100px;">标题：<input type="text" id="title"></span>
					<span>订单类别：<select id="type" style="width: 150px">
						<option value="1">帮我买</option>
						<option value="2">帮我送</option>
						<option value="3">帮我去</option>
						<option value="4">其他服务</option>
					</select></span>
					<span>商品类别：<select id="goodsType" style="width: 150px;">
						<option value="2">文件</option>
						<option value="3">蛋糕</option>
						<option value="4">鲜花</option>
						<option value="5">钥匙</option>
						<option value="6">手机</option>
						<option value="7">快递</option>
						<option value="8">美食</option>
						<option value="9">香烟</option>
						<option value="10">酒</option>
						<option value="11">饮料</option>
						<option value="12">早餐</option>
						<option value="13">夜宵</option>
						<option value="14">药品</option>
						<option value="15">水果</option>
						<option value="16">生鲜</option>
						<option value="1">其他</option>
					</select></span>
				</div>
				<div>
					<span>取货地址：</span>
					<span><input type="text" style="width: 550px;" id="startaddress"  value="" /></span>
				</div>
				<div>
					<span>取货人电话：<input type="text" id="startphone"></span>
					<span>取货人：<input type="text" id="startname"></span>
				</div>
				<div>
					<span>收货地址：</span>
					<span><input type="text" style="width: 550px;" id="endaddress"></span>
				</div>
				<div>
					<span>收货人电话：<input type="text" id="endphone"></span>
					<span>收货人：<input type="text" id="endname"></span>
				</div>
				<div>
					<span>备注：</span>
					<span><textarea style="width: 550px;min-height: 20px;" id="note"></textarea></span>
				</div>
				<div>
					<span>送货时间:</span>
					<span>
						<select name="" id="sendTime" style="width: 200px;">
							<option value="立即送货" selected="selected">立即送货</option>
							<option value="预约时间，可协商">预约时间，可协商</option>
						</select>
					</span>
					<span>订单价格：</span>
					<span><input type="number" id="price"></span>
				</div>
				<div>
					<span>接单员性别</span>
					<span>
						<select name="" id="corridorGender" style="width: 200px;">
							<option value="不限" selected="selected">不限</option>
							<option value="男">男</option>
							<option value="女">女</option>
						</select>
					</span>
				</div>
				<div style="text-align: center">
					<span><button id="btn-modify" style="background: #1d90e6">修改</button></span>
					<span><button id="btn-cancel">取消</button></span>
				</div>
			</table>
		</div>

		<div id="commentDialog1" class="commentDialog"style="display: none">
			<div>
				<h3 style="margin: 20px;font-size: 24px">评价一下该订单吧！</h3>
				<span style="margin-left: 50px">
					<textarea id="commnet-content1" style="width: 570px;min-height: 100px;border-radius: 5px;"></textarea>
				</span>
			</div>
			<div style="text-align: center;margin-top: 20px;">
				<span><button id="commnet-confirm1" style="background: #1c8de0">评价</button></span>
				<span><button id="comment-cancel1" style="margin-left: 30px;">取消</button></span>
			</div>
		</div>
	</body>
	<script>
            //订单类型选项点击事件
			var o_state="";
            $("#order_type").children("span").click(function(){
                $("#order_type").children("span").removeClass("on");
                $(this).addClass("on");
                 o_state = $(this).attr("name");
                getOrdersByo_state(o_state);
            });
            getOrdersByo_state("");
            function getOrdersByo_state(o_state){
                $("#order-list").empty();
                $.get("/order/get_orders?oState="+o_state,function (data) {
                    for (var i=0;i<data.length;i++){
                        showdata(data[i]);
                    }
                })
			}

		    function showdata(order) {
		        var oState = "";
		        var btn = "";
		        if (order.oState == 0){
		            oState = "未接单";
		            btn ='<span oId="'+order.oId+'" onclick="refreshOrder(this)">刷新订单</span>\n' +
                        '<span oId="'+order.oId+'" onclick="cancel(this)">取消订单</span>' +
						'<span oId="'+order.oId+'" onclick="modifyOrder(this)">修改订单</span>\n' ;
		        }
		        if (order.oState == 1){
		            oState = "已接单";
                    btn ='<span oId="'+order.oId+'" onclick="confirmRecvied(this)">确认收货</span>\n';
		        }
		        if (order.oState == 2){
		            oState = "待评价";
                    btn ='<span oId="'+order.oId+'" onclick="comment_recived(this,1)">评价接单员</span>\n';
		        }
		        if (order.oState == 3){oState = "已完成";}
		        if (order.oState == 4){
		            oState = "已取消";
                    btn ='<span oId="'+order.oId+'" onclick="deleteOrder(this)">删除订单</span>\n';
		        }

		        var recvied = ""
				if (order.oType == 1){
                    recvied ='\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="receiveInfo sendInfo">[取货]<span name="sendPhone" class="mobile">'+order.sendPhone+' </span>\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="sendPepole">'+order.sendPepole+'</span>\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="sendAddress" class="address"><span>地址：</span>'+order.sendAddress+'</span></div>\n';
				}
				var html='<ul class="orderList">\n' +
                    '\t\t\t\t\t\t\t\t<li class="box-shadow popUp">\n' +
                    '\t\t\t\t\t\t\t\t\t<div class="clear orderHeader">\n' +
                    '\t\t\t\t\t\t\t\t\t\t<div class="fl clear left ">\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t<span name="oId" class="orderId fl ">订单号：'+order.oId+'</span>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t<span name="title" class="orderMark fl omit">'+order.title+'</span></div>\n' +
                    '\t\t\t\t\t\t\t\t\t\t<div class="right fr">状态\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t<span name="oState">'+oState+'</span></div>\n' +
                    '\t\t\t\t\t\t\t\t\t</div>\n' +
                    '\t\t\t\t\t\t\t\t\t<table cellspacing="0" cellpadding="0" width="100%" class="clear orderInfo">\n' +
                    '\t\t\t\t\t\t\t\t\t\t<tr>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t<td class="clear firstInfo">\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t<div class="orderInfo-item first  width">\n' + recvied +
                    '\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="sendInfo clear">[收货信息]<span name="receivedPhone" class="mobile">'+order.receivedPhone+'</span>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="receivedPepole">'+order.receivedPhone+'</span>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="receivedAddress" class="address "><span>地址：</span>'+order.receivedAddress+'</span></div>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="sendInfo clear">[接单员性别]：<span name="corridorGender">'+order.corridorGender+'</span></div>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t</div>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t<td class="disMon orderInfo-item firstInfo">\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t<div><b>备注:</b><span name="remark">'+order.remark+'</span></div>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t<td class="disMon orderInfo-item firstInfo">\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t<div>金额：<span name="price">'+order.price+'</span>元</div>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t<td class="cancelOrder">\n' + btn +
                    '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                    '\t\t\t\t\t\t\t\t\t\t</tr>\n' +
                    '\t\t\t\t\t\t\t\t\t</table>\n' +
                    '\t\t\t\t\t\t\t\t\t<p  class="time">发单时间：<span name="oDate">'+order.oDate+'</span></p>\n' +
                    '\t\t\t\t\t\t\t\t</li>\n' +
                    '\t\t\t\t\t\t\t</ul>';
		        $("#order-list").append(html);
            }

        function refreshOrder(node) {
			var oId = node.getAttribute("oId");
            $.get("/order/refresh?oId="+oId,function (data) {
                if (data){
                    alert("订单已刷新");
                    getOrdersByo_state(o_state);
                }else {
                    alert("刷新失败");
                }
            })
        }

		function cancel(node) {
			var oId = node.getAttribute("oId");
			$.get("/order/cancel?oId="+oId,function (data) {
				if (data.success){
					alert("订单已取消");
                    getOrdersByo_state(o_state);
				}else {
					alert(data.msg);
				}
			})
		}

		function confirmRecvied(node) {
            var oId = node.getAttribute("oId");
            $.get("/order/confrim_recived?oId="+oId,function (data) {
                if (data){
                    alert("已确认收货，请去评价一下该订单吧！");
                    getOrdersByo_state(o_state);
                }else {
                    alert("确认收货失败！");
                }
            })
        }

        function comment_recived(node,userType) {
            var oId = node.getAttribute("oId");
            $("#commentDialog1").css("display","block");
            $("#commnet-confirm1").unbind("click").click(function () {
				var content = $("#commnet-content1").val();
				if (content == ""){
				    alert("请输入你的评论内容");
				    return;
				}
				$.post("/evaluate/add",{"oId":oId,"content":content,"userType":userType},function (data) {
					if (data){
					    alert("评论成功感谢你的评论！")
                        $("#commentDialog1").css("display","none");
                        getOrdersByo_state(o_state);
                        getRecived(STATE);
					}else {
					    alert("评论失败！")
					}
                })
            })
        }

        $("#comment-cancel1").click(function () {
            $("#commentDialog1").css("display","none");
        })
        function deleteOrder(node){
                var oId = node.getAttribute("oId");
                $.get("/order/delete?oId="+oId,function (data) {
                    if (data){
                        alert("订单已删除！");
                        getOrdersByo_state(o_state);
                    }else {
                        alert("删除订单失败！");
                    }
                })
        }

        function  modifyOrder(node) {
            var oId = node.getAttribute("oId");
            $.get("/order/get_order?oId="+oId,function (data) {
                $("#oId").text(data.oId);
               $("#title").val(data.title);
               $("#type").val(data.oType);
               $("#goodsType").val(data.goodsType);
               $("#startaddress").val(data.sendAddress);
               $("#startphone").val(data.sendPhone);
               $("#startname").val(data.sendPepole);
               $("#endaddress").val(data.receivedAddress);
               $("#endname").val(data.receivedPepole);
               $("#endphone").val(data.receivedPhone);
               $("#corridorGender").val(data.corridorGender);
               $("#sendTime").select(data.sendDate)
               $("#note").val(data.remark);
               $("#price").val(data.price);
               $("#tipDialog").css("display","block");
            })

			$("#btn-cancel").click(function () {
                $("#tipDialog").css("display","none");
            })

            $("#btn-modify").click(function () {
                var oId = $("#oId").text();
                var title = $("#title").val();
                if (title == ""){
                    alert("订单标题不能为空！");return;
				}
                var goodsType= $("#goodstype").val()
                var sendAddress = $("#startaddress").val();
                var sendPhone = $("#startphone").val();
                var sendPepole = $("#startname").val();
                var receivedAddress = $("#endaddress").val();
                if (receivedAddress == ""){alert("收货地址不能为空");return;}
                var receivedPepole = $("#endname").val();
                if (receivedPepole ==""){alert("请填写收货人");return;}
                var receivedPhone = $("#endphone").val();
                if (receivedPhone == ""){alert("请填写收货人联系电话");return;}
                var reg = /^1[34578][0-9]{9}$/; //验证规则
                if (!reg.test(receivedPhone)){
                    alert("收货人的手机号码格式不正确");return;
                }
                var remark = $("#note").val();
                if (remark == ""){alert("请填写你的备注信息");return;}
                var sendDate = $("#sendTime").val();
                var corridorGender = $("#corridorGender").val();
                var prcie = $("#price").val();
                if(prcie == ""){alert("请填写你的订单价格")}
                var oType = $("#type").val();
                $.ajax({
                    url:"/order/update",
                    dataType:"json",
                    type:"post",
                    data:{
                        "oId":oId,
                        "oType":oType,
                        "price":prcie,
                        "title":title,
                        "remark":remark,
                        "sendAddress":sendAddress,
                        "sendPhone":sendPhone,
                        "sendPepole":sendPepole,
                        "corridorGender":corridorGender,
                        "goodsType":goodsType,
                        "receivedPepole":receivedPepole,
                        "receivedPhone":receivedPhone,
                        "receivedAddress":receivedAddress,
                        "sendDate":sendDate,
                    },
                    success:function (data) {
                        if (data){
                            alert("修改成功！");
                            $("#tipDialog").css("display","none");
						}else {
                            alert("修改失败请检查")
						}
                    }
                })

            })
        }
	</script>
	<script>

		var STATE = -1;
        //订单类型选项点击事件
        $("#order_type2").children("span").click(function(){
            $("#order_type2").children("span").removeClass("on");
            $(this).addClass("on");
            STATE =  $("#order_type2").children("span[class='fl on']").attr("name");
            getRecived(STATE)
        });

        function getRecived(state) {
            $("#order-list2").empty();
            $.get("/recived/get?state="+state,function (data) {
                for (var i=0;i<data.length;i++){
                    showRecived(data[i]);
                }
            })
        }
        getRecived(-1);

        function showRecived(data) {
            var btn = "";
            var order = data.orders;
            var oState ="";
            if (data.state == 1){
                oState = "已接单";
                btn ='<span oId="'+data.id+'" onclick="giveUp(this)">放弃订单</span>\n';
            }
            if (data.state == 2){
                oState = "待评价";
                btn ='<span oId="'+order.oId+'" onclick="comment_recived(this,2)">评价雇主</span>\n';
            }
            if (data.state == 3){oState = "已完成";}
            if (data.state == 4){
                oState = "已取消";
                btn ='<span oId="'+data.id+'" onclick="delteOrderReciving(this)">删除订单</span>\n';
            }
            var recvied = ""
            if (order.oType == 1){
                recvied ='\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="receiveInfo sendInfo">[取货]<span name="sendPhone" class="mobile">'+order.sendPhone+' </span>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="sendPepole">'+order.sendPepole+'</span>\n' +
                    '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="sendAddress" class="address"><span>地址：</span>'+order.sendAddress+'</span></div>\n';
            }
            var html='<ul class="orderList">\n' +
                '\t\t\t\t\t\t\t\t<li class="box-shadow popUp">\n' +
                '\t\t\t\t\t\t\t\t\t<div class="clear orderHeader">\n' +
                '\t\t\t\t\t\t\t\t\t\t<div class="fl clear left ">\n' +
                '\t\t\t\t\t\t\t\t\t\t\t<span name="oId" class="orderId fl ">订单号：'+order.oId+'</span>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t<span name="title" class="orderMark fl omit">'+order.title+'</span></div>\n' +
                '\t\t\t\t\t\t\t\t\t\t<div class="right fr">状态\n' +
                '\t\t\t\t\t\t\t\t\t\t\t<span name="oState">'+oState+'</span></div>\n' +
                '\t\t\t\t\t\t\t\t\t</div>\n' +
                '\t\t\t\t\t\t\t\t\t<table cellspacing="0" cellpadding="0" width="100%" class="clear orderInfo">\n' +
                '\t\t\t\t\t\t\t\t\t\t<tr>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t<td class="clear firstInfo">\n' +
                '\t\t\t\t\t\t\t\t\t\t\t\t<div class="orderInfo-item first  width">\n' + recvied +
                '\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="sendInfo clear">[收货信息]<span name="receivedPhone" class="mobile">'+order.receivedPhone+'</span>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="receivedPepole">'+order.receivedPhone+'</span>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span name="receivedAddress" class="address "><span>地址：</span>'+order.receivedAddress+'</span></div>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t\t</div>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t<td class="disMon orderInfo-item firstInfo">\n' +
                '\t\t\t\t\t\t\t\t\t\t\t\t<div><b>备注:</b><span name="remark">'+order.remark+'</span></div>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t<td class="disMon orderInfo-item firstInfo">\n' +
                '\t\t\t\t\t\t\t\t\t\t\t\t<div>金额：<span name="price">'+order.price+'</span>元</div>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                '\t\t\t\t\t\t\t\t\t\t\t<td class="cancelOrder">\n' + btn +
                '\t\t\t\t\t\t\t\t\t\t\t</td>\n' +
                '\t\t\t\t\t\t\t\t\t\t</tr>\n' +
                '\t\t\t\t\t\t\t\t\t</table>\n' +
                '\t\t\t\t\t\t\t\t\t<p  class="time">接单时间：<span name="oDate">'+data.reciveDate+'</span></p>\n' +
                '\t\t\t\t\t\t\t\t</li>\n' +
                '\t\t\t\t\t\t\t</ul>';
            $("#order-list2").append(html);
        }

        function giveUp(node) {
            var id = node.getAttribute("oId");
            $.get("/recived/give_up?rId="+id,function (data) {
                if (data){
                    getRecived(STATE);
                    alert("已为你放弃订单，请告知雇主！");
                }else {
                    alert("放弃订单失败！");
                }
            })
        }

        function delteOrderReciving(node) {
            var id = node.getAttribute("oId");
            $.get("/recived/delete?rId="+id,function (data) {
                if (data){
                    getRecived(STATE);
                    alert("订单已删除！");
                }else {
                    alert("删除订单失败！");
                }
            })
        }
	</script>
	<script>
        //订单类型选项点击事件
        $("#order_type3").children("span").click(function(){
            $("#order_type3").children("span").removeClass("on");
            $(this).addClass("on");
        });

        $("#order_type3").children("span[name='0']").click(function () {
            getEvalaute();
        })
        $("#order_type3").children("span[name='1']").click(function () {
            getAccept();
        })
        getEvalaute();
        function getEvalaute() {
            $("#order-list3").empty();
			$.get("/evaluate/get_e",function (data) {
				for (var i=0;i<data.length;i++){
				    var evaluate = data[i];
				    $("#order-list3").append('<ul class="orderList">\n' +
                        '\t\t\t\t\t\t\t\t<li class="box-shadow popUp">\n' +
                        '\t\t\t\t\t\t\t\t\t<div class="clear orderHeader" style="height: 120px;">\n' +
                        '\t\t\t\t\t\t\t\t\t\t<div class="fl clear left ">\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t<span name="oId" class="orderId fl ">订单号：<span>'+evaluate.oId+'</span></span>\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t<span name="title" class="orderMark fl omit">受评价者：<span>'+evaluate.acceptUser+'</span></span>\n' +
                        '\t\t\t\t\t\t\t\t\t\t<br/>\n' +
                        '\t\t\t\t\t\t\t\t\t\t<table style="width: 100%;text-align: left;">\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t<tr><td width="90%" style="margin-left: 10px;">'+evaluate.content+'</td>\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t\t<td><button class="button" onclick="deteEvalaute('+evaluate.id+')">删除评论</button></td></tr>\n' +
                        '\t\t\t\t\t\t\t\t\t\t</table>\n' +
                        '\t\t\t\t\t\t\t\t\t\t</div>\n' +
                        '\t\t\t\t\t\t\t\t\t</div>\n' +
                        '\t\t\t\t\t\t\t\t\t<p  class="time">评论时间：<span name="oDate">'+evaluate.date+'</span></p>\n' +
                        '\t\t\t\t\t\t\t\t</li>\n' +
                        '\t\t\t\t\t\t\t</ul>')
				}
            })
        }

        function getAccept() {
            $("#order-list3").empty();
            $.get("/evaluate/get_a",function (data) {
                for (var i=0;i<data.length;i++){
                    var evaluate = data[i];
                    $("#order-list3").append('<ul class="orderList">\n' +
                        '\t\t\t\t\t\t\t\t<li class="box-shadow popUp">\n' +
                        '\t\t\t\t\t\t\t\t\t<div class="clear orderHeader" style="height: 120px;">\n' +
                        '\t\t\t\t\t\t\t\t\t\t<div class="fl clear left ">\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t<span name="oId" class="orderId fl ">订单号：<span>'+evaluate.oId+'</span></span>\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t<span name="title" class="orderMark fl omit">评价者：<span>'+evaluate.evaluateUser+'</span></span>\n' +
                        '\t\t\t\t\t\t\t\t\t\t<br/>\n' +
                        '\t\t\t\t\t\t\t\t\t\t<table style="width: 100%;text-align: left;">\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t<tr><td width="90%" style="margin-left: 10px;">'+evaluate.content+'</td>\n' +
                        '\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n' +
                        '\t\t\t\t\t\t\t\t\t\t</table>\n' +
                        '\t\t\t\t\t\t\t\t\t\t</div>\n' +
                        '\t\t\t\t\t\t\t\t\t</div>\n' +
                        '\t\t\t\t\t\t\t\t\t<p  class="time">评论时间：<span name="oDate">'+evaluate.date+'</span></p>\n' +
                        '\t\t\t\t\t\t\t\t</li>\n' +
                        '\t\t\t\t\t\t\t</ul>')
                }
            })
        }

        function deteEvalaute(id) {
			$.get("/evaluate/delete?eId="+id,function (data) {
				if (data){
				    alert("删除评论成功！");
				    getEvalaute();
				} else {
				    alert("删除评论失败!");
				}
            })
        }
	</script>
</html>
